package com.second.statistics.service.impl;

import com.second.common.pojo.R;
import com.second.statistics.dao.TbOrderDao;
import com.second.statistics.service.TbOrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @program: clms-second
 * @description:
 * @author: 赵博岩
 * @create: 2021-07-24 16:13
 **/
@Service
public class TbOrderImpl implements TbOrderService {
    @Resource
    private TbOrderDao tbOrderDao;
    @Override
    public R TbOrder(String ymonth) {
        List<Map> list = tbOrderDao.TbOrder(ymonth);
        List<String> data=new ArrayList<>();
        List<String> price=new ArrayList<>();
        for (Map map:list){
            data.add(String.valueOf(map.get("day")));
            price.add(String.valueOf(map.get("price")));
        }
        Map chardata = new HashMap<>();
        chardata.put("day" ,data);
        chardata.put("price",price);
        return R.success().putObject(chardata);
    }
    }

